#ifndef ENVIRONMENT_H
#define ENVIRONMENT_H

#include "AReVi/arObject.h"
using namespace AReVi;

#include "element.h"

/** Description */
class Environment : public ArObject {
public:
    AR_CLASS(Environment)
    AR_CONSTRUCTOR(Environment)
    
    /** Is element in the environment ? */
    bool hasElement(StlString id);
    /** Retreive an element by its ID */
    ArRef<Element> getElementByID(StlString id);
    /** Add an element to the environment */
    void addElement(ArRef<Element> element);
    /** Remove the element from the environment */
    void removeElement(ArRef<Element> element);
    
    /** Clear local elements */
    void clearLocal();
    
protected:
    /** Callback on element list request */
    void _onListRequest(ArRef<Event> evt);
    /** Callback when retreiving a list of elements */
    void _onList(ArRef<Event> evt);
    /** Callback for element info request */
    void _onElementInfoRequest(ArRef<Event> evt);

    /** Callback for element creation */
    void _onElementCreate(ArRef<Event> evt);
    /** Callback for element info */
    void _onElementInfo(ArRef<Event> evt);
    /** Callback for element deletion */
    void _onElementDelete(ArRef<Event> evt);

    /** Vector containing the elements */
    StlVector<ArRef<Element> > _elements;
};

#endif
